I managed to stumble across a solution. My problem was that the header files provided by the first CMake project have to be explicitly added to the qt_add_executable stanza so that the meta-object compiler picks them up, and when I first tried it the variable I thought I read them to was, in fact, empty.
This is why I received so many linker errors when using the ifdef __cplusplus in the header file. The shared header file was being used through an #import statement but for some reason meta-object compiler only processed the header file which included it, not the shared header itself.
After noticing that the variable was empty I explicitly added the header files to qt_add_executable, and much to my surprise the linker error is now gone, and everything works.